home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / guitar-geek.swf / scripts / MochiBot.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  1.6 KB  |  57 lines

  1. package
  2. {
  3.    import flash.display.Loader;
  4.    import flash.display.Sprite;
  5.    import flash.net.URLRequest;
  6.    import flash.net.URLRequestMethod;
  7.    import flash.net.URLVariables;
  8.    import flash.system.Capabilities;
  9.    import flash.system.Security;
  10.    
  11.    public dynamic class MochiBot extends Sprite
  12.    {
  13.        
  14.       
  15.       public function MochiBot()
  16.       {
  17.          super();
  18.       }
  19.       
  20.       public static function track(parent:Sprite, tag:String) : MochiBot
  21.       {
  22.          if(Security.sandboxType == "localWithFile")
  23.          {
  24.             return null;
  25.          }
  26.          var self:MochiBot = new MochiBot();
  27.          parent.addChild(self);
  28.          Security.allowDomain("*");
  29.          Security.allowInsecureDomain("*");
  30.          var server:String = "http://core.mochibot.com/my/core.swf";
  31.          var lv:URLVariables = new URLVariables();
  32.          lv["sb"] = Security.sandboxType;
  33.          lv["v"] = Capabilities.version;
  34.          lv["swfid"] = tag;
  35.          lv["mv"] = "8";
  36.          lv["fv"] = "9";
  37.          var url:String = self.root.loaderInfo.loaderURL;
  38.          if(url.indexOf("http") == 0)
  39.          {
  40.             lv["url"] = url;
  41.          }
  42.          else
  43.          {
  44.             lv["url"] = "local";
  45.          }
  46.          var req:URLRequest = new URLRequest(server);
  47.          req.contentType = "application/x-www-form-urlencoded";
  48.          req.method = URLRequestMethod.POST;
  49.          req.data = lv;
  50.          var loader:Loader = new Loader();
  51.          self.addChild(loader);
  52.          loader.load(req);
  53.          return self;
  54.       }
  55.    }
  56. }
  57.